var pre1 = document.getElementsByClassName('pre')[0]
var next1 = document.getElementsByClassName('next')[0]
var cal = document.getElementsByClassName('cal-list')[0]
var viewpage = document.getElementsByClassName('viewpage')[0]
var items = document.getElementsByClassName('item')
var circleList = document.getElementsByClassName('circle-list')[0]
var circles = document.getElementsByClassName('circle')
var circleIndex = 0//焦点索引s
//图片轮播
var interId11
var index1 = 0
function autoPlay1() {
  interId11 = setInterval(function () {
    next1.onclick()
  }, 3000)
}
autoPlay1()
cal.onmouseover = function (e) {
  clearInterval(interId11)
  pre1.style.dispaly = 'block'
  next1.style.dispaly = 'block'
  console.log('鼠标进入');

}
cal.onmouseleave = function (e) {
  autoPlay1()
  pre1.style.dispaly = 'none'
  next1.style.dispaly = 'none'
  console.log('鼠标离开');
}
next1.onclick = function () {
  if (circleIndex == circles.length - 1) {
    circleIndex = -1
  }
  circleIndex++
  if (index1 == items.length - 1) {
    index1 = 0
    viewpage.style.left = '0px'
  }
  index1++
  var target = -704 * index1
  initCalColor()
  circles[circleIndex].className = 'circle active'
  moveAnimation1(viewpage, target)
}

pre1.onclick = function () {
  if (circleIndex == 0) {
    circleIndex = circles.length
  }
  circleIndex--
  if (index1 == 0) {
    index1 = items.length - 1
  }
  index1--
  var target = -704 * index1
  initCalColor()
  circles[circleIndex].className = 'circle active'
  moveAnimation1(viewpage, target)
}
function initCalColor() {
  for (var i = 0; i < circles.length; i++) {
    circles[i].className = 'circle'
  }
}
for (let i = 0; i < circles.length; i++) {
  circles[i].onclick = function () {
    index1 = i
    circleIndex = i
    var target = -704 * index1
    initCalColor()
    circles[i].className = 'circle active'
    moveAnimation1(viewpage, target)
  }
}
